CXX=g++
CC=gcc
CPPFLAGS=-I. -I/usr/local/include/SDL2 -I/usr/include -O3
#CFLAGS=-I. -I/usr/local/include/SDL2
#CPPSOURCES=$(wildcard *.cpp)
CPPSOURCES=main.cpp mythSQLresult.cpp mythBaseServer.cpp mythVirtualSqlite.cpp tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp mythVirtualServer.cpp PEOPLE.cpp
CPPOBJECTS=$(CPPSOURCES:.cpp=.o)
#CSOURCES=$(wildcard *.c)
#COBJECTS=$(CSOURCES:.c=.o)
TARGET=grandserver

.PHONY: all clean

all: .dcpp $(CPPSOURCES) $(TARGET)

.dcpp: $(CPPSOURCES)
	$(CXX) $(CPPFLAGS) -MM $(CPPSOURCES) >.dcpp
#.dc: $(CSOURCES)
#	$(CC) $(CFLAGS) -MM $(CSOURCES) >.dc
-include .dcpp
#-include .dc
$(TARGET): $(CPPOBJECTS) $(COBJECTS)
	$(CXX) $(CPPOBJECTS) $(COBJECTS) -o $@ -L/usr/lib -lsqlite3 -L/usr/local/lib -lSDL2 -lSDL2_net -liconv -lstdc++

clean:
	rm $(CPPOBJECTS) $(COBJECTS) .dcpp
